import greenfoot.*;  // (World, Actor, GreenfootImage, Greenfoot and MouseInfo)

/**
 * Write a description of class Utileria here.
 * 
 * @author (your name) 
 * @version (a version number or a date)
 */
public class Utileria extends Otros
{
    private int ima;
    int caj=0;
    /**
     * Act - do whatever the Utileria wants to do. This method is called whenever
     * the 'Act' or 'Run' button gets pressed in the environment.
     */
    public Utileria(int im){
        ima=im;
        if(im==0)
         setImage("cuadro1.png");
        if(im==1)
         setImage("cajon.png");
         
    }
    public void act() 
    {
       
       if(ima==0){
         if(isTouching(Mueble.class)){
             if((getOneIntersectingObject(Mueble.class)).getRotation()==45){
               setRotation(90);
               move(15);
               
               if(caj==0){
               Caja ll=new Caja(5);
               getWorld().addObject(ll,getX(),getY()+50);
               caj=1;}
            }
            }
        }
    }    
}
